|
|
|
|
- Type of import
- Array items
- Format of expected XML
<Source>.ImportXML (Function) In french: <Source>.ImporteXML
![HFSQL Classic HFSQL Classic](https://doc.windev.com/ext/images/us/HF.png?-2134303037) Available only with these kinds of connection
Syntax
<Result> = <Source>.ImportXML([<Path of the XML file> , <Destination items> [, <XML attributes to import>]] [, <Options> [, <Progress Bar> [, <Root node>]]])
<Result>: Boolean - True if the operation was performed,
- False if an error occurred. HError is used to identify the problem.
<Source>: Type corresponding to the specified source Name of the HFSQL data file into which the import must be performed. <Path of the XML file>: Optional character string Full access path to XML file to import. <Destination items>: Optional character string List of names of items in the data file into which the import will be performed. The names can be delimited by single quotes and they are separated by commas or CR characters. The names of the composite key items, binary memo items and binary items are ignored. The non-imported items will be initialized with their default value described in the analysis. If this parameter is not specified or if it corresponds to an empty string, all the items are imported (except the composite keys, the binary items and the binary memos) in the physical order of description. <XML attributes to import>: Optional character string List of names of items found in the XML file to import. If this parameter is not specified or if it corresponds to an empty string, all the nodes of XML files are imported. <Options>: Optional Integer constant (or combination of constants) Configures the type of import to perform: | | hImpBreakable | The import can be interrupted by pressing the Esc key on the keyboard. If the import is interrupted, the imported records are kept in the data file. | hImpCreation | If the import data file exists, it is overwritten. | hImpNormal (default value) | If the import data file already exists, it is filled with the imported data ; otherwise, the data file is created. |
<Progress Bar>: Optional control or window name - Name of the window in which the progress bar will be displayed
- Name of the Progress Bar control.
<Root node>: Optional character string Node of XML file from which the import will be performed. Used to import a section of XML file into the HFSQL data file. The type of this parameter is "root/clients". Remarks Array items <Source>.ImportXML can also be used to import array items. To do so, the array elements must be included in the child tags. Example: The data file described in the analysis contains the following items: ITEM1, ITEM2, ARRAYITEM. The ARRAYITEM item is an array item. The list of items is "ITEM1+ITEM2+ARRAYITEM" and the XML file has the following structure: <FILE>
<ITEM1>Data1</ITEM1>
<ITEM2>Data2</ITEM2>
<ARRITEM>
<!-- child tags -->
<ARRAYITEM_1>ArrayData1</ARRAYITEM_1>
<ARRAYITEM_2>ArrayData2</ARRAYITEM_2>
</ARRITEM>
</FILE>
... 'Data1' will be assigned to 'ITEM1', 'Data2' will be assigned to 'ITEM2', 'ArrayData1' will be assigned to 'ARRAYITEM[1]', 'ArrayData2' will be assigned to ARRAYITEM[2]'. Format of expected XML <Source>.ImportXML expects an XML file with a specific structure. Example: <racine><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<record>
<item1>val</item1>
<item2>val</item2>
</record>
<record>
<item1>val</item1>
<item2>val</item2>
</record>
</root> This format is also used by <Source>.ExportXML. If your XML file does not use this structure, the import will not be performed properly. You may get one record per item for example. Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|